package com.seek.eduservice.service.impl;

import com.seek.eduservice.entity.EduComment;
import com.seek.eduservice.entity.EduCourseLike;
import com.seek.eduservice.entity.vo.CommentQuery;
import com.seek.eduservice.entity.vo.CommentVo;
import com.seek.eduservice.mapper.EduCommentMapper;
import com.seek.eduservice.service.EduCommentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 评论 服务实现类
 * </p>
 *
 * @author wml
 * @since 2022-03-25
 */
@Service
public class EduCommentServiceImpl extends ServiceImpl<EduCommentMapper, EduComment> implements EduCommentService {

    // 根据课程 id 查看所有评论，根据添加时间排序
    @Override
    public List<EduCourseLike> getCommentByCourseId(String courseId, String memberId, long start, long size) {
        return baseMapper.getCommentByCourseId(courseId, memberId, start, size);
    }

    // 根据评论 id 进行查询
    @Override
    public CommentVo getCommentInfoById(String id) {
        return baseMapper.getCommentInfoById(id);
    }

    // 条件查询带分页的方法 查列表
    @Override
    public List<CommentVo> pageCondition(int start, int size, CommentQuery commentQuery) {
        return baseMapper.pageCondition(start, size, commentQuery);
    }

    // 条件查询带分页的方法 查总数
    @Override
    public int count(CommentQuery commentQuery) {
        return baseMapper.count(commentQuery);
    }
}
